library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.5     ✓ dplyr   1.0.7
## ✓ tidyr   1.1.4     ✓ stringr 1.4.0
## ✓ readr   2.0.2     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(ggplot2)
library(forecast)
## Warning: package 'forecast' was built under R version 4.1.2
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
library(astsa) 
## 
## Attaching package: 'astsa'
## The following object is masked from 'package:forecast':
## 
##     gas
library(xts)
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## 
## Attaching package: 'xts'
## The following objects are masked from 'package:dplyr':
## 
##     first, last
library(tseries)
library(fpp2)
## ── Attaching packages ────────────────────────────────────────────── fpp2 2.4 ──
## ✓ fma       2.4     ✓ expsmooth 2.3
## 
## 
## Attaching package: 'fpp2'
## The following object is masked from 'package:astsa':
## 
##     oil
library(fma)
library(lubridate)
## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union
library(tidyverse)
library(TSstudio)
library(quantmod)
## Loading required package: TTR
library(tidyquant)
## Loading required package: PerformanceAnalytics
## 
## Attaching package: 'PerformanceAnalytics'
## The following object is masked from 'package:graphics':
## 
##     legend
## ══ Need to Learn tidyquant? ════════════════════════════════════════════════════
## Business Science offers a 1-hour course - Learning Lab #9: Performance Analysis & Portfolio Optimization with tidyquant!
## </> Learn more at: https://university.business-science.io/p/learning-labs-pro </>
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(ggplot2)
India<-read.csv("StatewiseTestingDetails.csv")
India$Positive_rate<-India$Positive/India$TotalSamples
head(India)
##         Date                       State TotalSamples Negative Positive
## 1 2020-04-17 Andaman and Nicobar Islands         1403     1210       12
## 2 2020-04-24 Andaman and Nicobar Islands         2679       NA       27
## 3 2020-04-27 Andaman and Nicobar Islands         2848       NA       33
## 4 2020-05-01 Andaman and Nicobar Islands         3754       NA       33
## 5 2020-05-16 Andaman and Nicobar Islands         6677       NA       33
## 6 2020-05-19 Andaman and Nicobar Islands         6965       NA       33
##   Positive_rate
## 1   0.008553100
## 2   0.010078387
## 3   0.011587079
## 4   0.008790623
## 5   0.004942339
## 6   0.004737976
India$date<-as.Date(India$Date,"%Y-%m-%d")
p<- ggplot(India, aes(x=date)) +
  geom_line(aes(y=Positive_rate, colour="red"))+
ggtitle("Covid-19 Positive rate in India")

ggplotly(p)